package com.ksm.client.document.presenter;

import com.google.gwt.user.client.ui.IsWidget;
import com.google.inject.Inject;
import com.ksm.client.ManagerEventBus;
import com.ksm.client.document.presenter.DocumentPreviewPresenter.IDocumentPreviewView;
import com.ksm.client.document.service.IKsmServiceAsync;
import com.ksm.client.document.view.DocumentPreviewView;
import com.ksm.transfer.dto.JustificatifDTO;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.mvp4g.client.view.ReverseViewInterface;

@Presenter(view = DocumentPreviewView.class)
public class DocumentPreviewPresenter extends BasePresenter<IDocumentPreviewView, ManagerEventBus> implements IDocumentPreviewPresenter {

	@Inject
	IKsmServiceAsync ksmService;

	public interface IDocumentPreviewView extends IsWidget, ReverseViewInterface<IDocumentPreviewPresenter> {
		public void updateImage(String url);
	}

	@Override
	public void onDocumentNewLoad() {
		getView().updateImage("");
	}

	@Override
	public void onJustificatifGridLoad(JustificatifDTO justificatifDTO) {
		getView().updateImage(justificatifDTO.getPathPreviewFile());
	}
}
